package ai.plantdata.Structural.mode.AdapterPattern.adapter;

import ai.plantdata.Structural.mode.AdapterPattern.interfaces.AdvancedMediaPlayer;
import ai.plantdata.Structural.mode.AdapterPattern.interfaces.MediaPlayer;
import ai.plantdata.Structural.mode.AdapterPattern.interfaces.impl.Mp4Player;
import ai.plantdata.Structural.mode.AdapterPattern.interfaces.impl.VlcPlayer;

public class MediaAdapter implements MediaPlayer {
 
   AdvancedMediaPlayer advancedMusicPlayer;
 
   public MediaAdapter(String audioType){
      if("vlc".equalsIgnoreCase(audioType) ){
         advancedMusicPlayer = new VlcPlayer();
      } else if ("mp4".equalsIgnoreCase(audioType)){
         advancedMusicPlayer = new Mp4Player();
      }  
   }

   @Override
   public void play(String audioType, String fileName) {
      if("vlc".equalsIgnoreCase(audioType)){
         advancedMusicPlayer.playVlc(fileName);
      }else if("mp4".equalsIgnoreCase(audioType)){
         advancedMusicPlayer.playMp4(fileName);
      }
   }
}